<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}LandPPT - AI PPT Generator{% endblock %}</title>
    <link rel="icon" type="image/svg+xml" href="{{ url_for('/static/images/favicon.svg') }}">
    <link rel="alternate icon" href="{{ url_for('/favicon.ico') }}">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        @import url('https://fonts.loli.net/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

        :root {
            --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
            --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
            --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);

            --glass-bg: rgba(255, 255, 255, 0.25);
            --glass-border: rgba(255, 255, 255, 0.18);
            --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

            --neumorphism-light: #ffffff;
            --neumorphism-dark: #d1d9e6;
            --neumorphism-shadow-light: rgba(255, 255, 255, 0.7);
            --neumorphism-shadow-dark: rgba(163, 177, 198, 0.6);

            --text-primary: #2d3748;
            --text-secondary: #4a5568;
            --text-muted: #718096;

            --border-radius-sm: 12px;
            --border-radius-md: 16px;
            --border-radius-lg: 24px;
            --border-radius-xl: 32px;

            --spacing-xs: 8px;
            --spacing-sm: 12px;
            --spacing-md: 16px;
            --spacing-lg: 24px;
            --spacing-xl: 32px;
            --spacing-2xl: 48px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            line-height: 1.6;
            color: var(--text-primary);
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            overflow-x: hidden;
            position: relative;
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background:
                radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
            pointer-events: none;
            z-index: -1;
        }

        /* Embed container - full viewport */
        .embed-container {
            width: 100vw;
            height: 100vh;
            padding: 0;
            margin: 0;
            overflow: hidden;
            position: relative;
        }

        /* Content area for embed */
        .embed-content {
            width: 100%;
            height: 100%;
            padding: var(--spacing-md);
            overflow-y: auto;
            background: var(--glass-bg);
            backdrop-filter: blur(30px);
            border: 1px solid var(--glass-border);
        }

        /* Card styles for embed */
        .card {
            background: var(--glass-bg);
            backdrop-filter: blur(30px);
            border: 1px solid var(--glass-border);
            border-radius: var(--border-radius-lg);
            padding: var(--spacing-lg);
            margin-bottom: var(--spacing-lg);
            box-shadow: var(--glass-shadow);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .card:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.5);
        }

        /* Button styles */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: var(--spacing-xs);
            padding: var(--spacing-sm) var(--spacing-lg);
            border: none;
            border-radius: var(--border-radius-sm);
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 500;
            text-decoration: none;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
            min-height: 44px;
        }

        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .btn:hover::before {
            left: 100%;
        }

        .btn-primary {
            background: var(--primary-gradient);
            color: white;
            box-shadow: 0 4px 15px 0 rgba(102, 126, 234, 0.4);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px 0 rgba(102, 126, 234, 0.6);
        }

        .btn-success {
            background: var(--success-gradient);
            color: white;
            box-shadow: 0 4px 15px 0 rgba(67, 233, 123, 0.4);
        }

        .btn-success:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px 0 rgba(67, 233, 123, 0.6);
        }

        /* Loading animation */
        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Responsive design */
        @media (max-width: 768px) {
            .embed-content {
                padding: var(--spacing-sm);
            }
            
            .card {
                padding: var(--spacing-md);
                margin-bottom: var(--spacing-md);
                border-radius: var(--border-radius-md);
            }
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <div class="embed-container">
        <div class="embed-content">
            {% block content %}{% endblock %}
        </div>
    </div>

    <!-- Global JavaScript variables -->
    <script>
        // Global configuration for embed
        window.EMBED_CONFIG = {
            batchId: "{{ batch_id if batch_id else '' }}",
            projectId: "{{ project.project_id if project else '' }}",
            parentOrigin: "https://yunzhishi.zzz4ai.com"
        };

        // Post message to parent when ready
        document.addEventListener('DOMContentLoaded', function() {
            if (window.EMBED_CONFIG.batchId) {
                try {
                    parent.postMessage({
                        type: 'PPT_READY',
                        payload: {
                            batchId: window.EMBED_CONFIG.batchId,
                            projectId: window.EMBED_CONFIG.projectId
                        }
                    }, window.EMBED_CONFIG.parentOrigin);
                    
                    console.log('PPT_READY message sent to parent:', {
                        batchId: window.EMBED_CONFIG.batchId,
                        projectId: window.EMBED_CONFIG.projectId
                    });
                } catch (error) {
                    console.error('Failed to send PPT_READY message:', error);
                }
            }
        });

        // Helper function for AJAX requests
        function makeRequest(url, options = {}) {
            const defaultOptions = {
                headers: {
                    'Content-Type': 'application/json',
                    'X-Requested-With': 'XMLHttpRequest'
                }
            };
            
            return fetch(url, { ...defaultOptions, ...options });
        }

        // Utility functions
        function showLoading(element) {
            if (element) {
                element.innerHTML = '<span class="loading"></span> 加载中...';
                element.disabled = true;
            }
        }

        function hideLoading(element, originalText) {
            if (element) {
                element.innerHTML = originalText;
                element.disabled = false;
            }
        }
    </script>
    
    {% block extra_js %}{% endblock %}
</body>
</html>
